package com.gambi.example.client;

import com.gambi.example.client.chatter.control.MessengerServiceClientImpl;
import com.gambi.example.client.gwtui.widgets.CheckBoxWidget;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.dom.client.Element;
import com.google.gwt.i18n.client.Dictionary;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.RootPanel;

public class GWTUI extends GWTTapestry implements EntryPoint {

	@Override
	public Composite widgetFactory(String id) {
		
		Dictionary dictionary = Dictionary.getDictionary(id);
		Element element = RootPanel.get(id).getElement();
		String type = dictionary.get("type");

		/*
		 * Add here the componentType IDs that this entry point can load
		 */
		if ("CheckBox".equals(type))
		{
			return new CheckBoxWidget(id, dictionary);
		}

		if ("Chatter".equals(type))
		{
			return new MessengerServiceClientImpl(dictionary).getView();
		}

		return null;

	}
}
